/*
*    UNIVERSIDADE DE SÃO PAULO.
*    Author: Marco Aurélio Gerosa (gerosa@ime.usp.br)
*
*    This file is part of Groupware Workbench (http://www.groupwareworkbench.org.br).
*
*    Groupware Workbench is free software: you can redistribute it and/or modify
*    it under the terms of the GNU Lesser General Public License as published by
*    the Free Software Foundation, either version 3 of the License, or
*    (at your option) any later version.
*
*    Groupware Workbench is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU Lesser General Public License for more details.
*
*    You should have received a copy of the GNU Lesser General Public License
*    along with Swift.  If not, see <http://www.gnu.org/licenses/>.
*/
package br.org.groupwareworkbench.aun.news;

import br.com.caelum.vraptor.Get;
import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Resource;
import br.com.caelum.vraptor.Result;
import br.com.caelum.vraptor.ioc.RequestScoped;
import br.com.caelum.vraptor.view.Results;

@Resource
@RequestScoped
public class NewsConfigurationController {
    
    private Result result;

    public NewsConfigurationController(Result result) {
        this.result = result;
    }
    
    @Get
    @Path(value = "/groupware-workbench/{collabletInstance}/news/configure")
    public void listNewsConfigure(NewsMgrInstance collabletInstance ) {
        // Deve de acontecer alguma coisa em este método.
        result.include("newsMgr", collabletInstance);
    }

    @Get
    @Path(value = "/groupware-workbench/{collabletInstance}/news/copyNewsFromAUN")
    public void copyFromAUN(NewsMgrInstance collabletInstance ) {
        System.out.println("llego a esta funcion para copiar dados do banco aun");
        collabletInstance.copyFromAUN(collabletInstance.getId());
        result.use(Results.logic()).redirectTo(NewsMgrController.class).list(collabletInstance);
    }
}
